/* tiff.h
 * This file is part of Landmerge (http://code.google.com/p/landmerge/)
 * Copyright (c) Matus Tejiscak 2008
 * Covered by GNU GPL v3 (http://www.gnu.org/licenses/gpl.txt).
 */

#ifndef _TIFF_H_
#define _TIFF_H_

#include <tiffio.h>

/// Represents a single TIFF image.
typedef struct tiff_t
{
	/// LibTIFF handle.
	TIFF *tiff;
	/// Pointer to the scanline.
	tdata_t scanline;
	/// Row size, in bytes.
	unsigned row_size;
	/// Row count = image height.
	unsigned row_count;
	/// Current row index.
	unsigned cur_row;
}
tiff_t;

/// Opens a TIFF file for reading.
tiff_t *tiff_open_r(const char *filename);

/// Seeks in a TIFF file to the specified row index.
void tiff_seek(tiff_t *tiff, unsigned row);
/// Advances to the next scanline.
void tiff_next_scanline(tiff_t *tiff);

/// Checks for end-of-file.
int tiff_eof(tiff_t *tiff);

/// Closes a TIFF file.
void tiff_close(tiff_t *tiff);

#endif
